(function($){
 $(document).on('click', '.paginator>li', function(event){
     var $this = $(this);  
     if($this.hasClass('pageNumDisable')){
    	 return;
     }
     var box =  $this.parent();
     var idx = box.data('index');
     var pageIndex = 1;      
     if($this.hasClass('prevPage')){
    	 pageIndex = idx > 1 ? (idx -1) : idx;
     }else if($this.hasClass("nextPage")){
    	 var last = box.data('last');
    	 pageIndex = idx >= last ? last : (idx + 1 );
     }else{
    	 pageIndex = $this.text();
     }
     /*if(pageIndex == idx){
    	 return;
     }*/
     var frm = $('form',$this.parents('.paginatorBar'));
     var pageSize = $('input[name="pageSize"]').val();
     var param = {pageIndex:pageIndex,pageSize:pageSize};
     var url = box.attr('target') || '';     
     if(frm.length!=0){
		 $.each(frm.serializeArray(),function(i,obj){
		     if(obj.name!='pageIndex' && obj.name !='pageSize'){
		    	 param[obj.name]=obj.value;
		     }
		 });
		 url =  frm.attr('action');
     } 
     //获得查询条件
     var searchForm = $('#searchForm');
     $.each(searchForm.serializeArray(),function(i,obj){
    	 param[obj.name]=obj.value;
	 });
/*     var containBox = box.attr('contaiBox');
     containBox = containBox == null || containBox == ''? 'content' : containBox;
     var el = $('#'+containBox);
     if(el.length!=0){
		 $('li',box).removeClass('pageNumActive');
		 $this.addClass('pageNumActive');
	     showLoading();
		 $.post(url,param,function(data){el.html(data);},"html"); 
		 hideLoading();
     }else if(frm.length == 1){
		 $('[name=pageIndex]').val(pageIndex);
		 frm.submit();
	 }else{*/
		 window.location.href = url + (url.indexOf('?') ==-1 ? '?' : '&') + $.param(param);
    	 hideLoading();
	 /*}*/
     event.preventDefault();
 });
})(jQuery);